home *** CD-ROM | disk | FTP | other *** search
- #include <dos.h>
-
- DisplaySize ()
-
- /*
- +-----------------------------------------------------------+
- | |
- | This procedure displays the current program size on the |
- | first line of the screen when called. |
- | |
- +-----------------------------------------------------------+
- */
-
- {
- int row, column ;
- long codesize, dataused, dataalloced, allocused, allocated ;
- char string [83] ;
-
- ProgSize (&codesize, &dataused, &dataalloced, &allocused, &allocated) ;
- getcursor ( &row, &column ) ;
- locatecursor ( 0 , 0 ) ;
-
- /* NOTE: In the following message,
-
- C: refers to the program's code size (bytes).
- DU: refers to how much space is actually being
- used in the program's default data segment.
- (bytes).
- DA: refers to how much space was actually allocated
- to the program's default data segment (bytes).
- AU: refers to how much space has been allocated
- via the memory allocation procedures (bytes).
- AA: refers to how much space was actually allocated
- to accommodate the user memory allocations (bytes).
- Total: refers to the total program size (bytes).
- */
-
- printf (
- "C: %6ld DU: %6ld DA: %6ld AU: %6ld AA: %6ld Total: %6ld ",
- codesize, dataused, dataalloced, allocused, allocated,
- codesize + dataalloced + allocated ) ;
- locatecursor ( row , column ) ;
- }
-
- static int getcursor ( row, column )
-
- int *row ;
- int *column ;
-
- /*
- +-----------------------------------------------------------+
- | |
- | This procedure returns the current cursor position. |
- | |
- +-----------------------------------------------------------+
- */
-
- {
- union REGS regs ;
-
- regs.h.ah = 0x03 ;
- regs.h.bh = 0 ;
- int86 ( 0x10, ®s, ®s ) ;
- *row = regs.h.dh ;
- *column = regs.h.dl ;
- }
-
- static int locatecursor ( row, column )
-
- int row ;
- int column ;
-
- /*
- +-----------------------------------------------------------+
- | |
- | This procedure set the cursor position to row, column. |
- | |
- +-----------------------------------------------------------+
- */
-
- {
- union REGS regs ;
-
- regs.h.ah = 0x02 ;
- regs.h.bh = 0 ;
- regs.h.dh = row ;
- regs.h.dl = column ;
- int86 ( 0x10, ®s, ®s ) ;
- }